$(function(){
    $("<li class='li-inline' style='margin-left:8px;'><a href='javascript:;' id='link-prev'>上一天</a> <a href='javascript:;' id='link-next'>下一天</a></li>").insertAfter($(".li-inline[for='time']"));

    $("#link-prev").click(function(){
        var date = new Date($("#input-time").val());

        date.setDate(date.getDate()-1);

        var y = date.getFullYear();
        var m = date.getMonth() + 1;
        if(m < 10) m = '0' + m;
        var d = date.getDate();
        if(d < 10) d = '0' + d;
        var newDate =  y+"-"+m+"-"+d;

        $("#input-time").val(newDate);

        $("#filter-btn").click();
    });

    $("#link-next").click(function(){
        var date = new Date($("#input-time").val());

        date.setDate(date.getDate()+1);

        var y = date.getFullYear();
        var m = date.getMonth() + 1;
        if(m < 10) m = '0' + m;
        var d = date.getDate();
        if(d < 10) d = '0' + d;
        var newDate =  y+"-"+m+"-"+d;

        $("#input-time").val(newDate);

        $("#filter-btn").click();
    });
});